package com.lzb.musicplayer.adapter;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;

import com.blankj.utilcode.util.ConvertUtils;
import com.blankj.utilcode.util.FileUtils;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.lzb.basic.ProviderMultiAdapter;
import com.lzb.basic.media.AudioBean;
import com.lzb.musicplayer.R;
import com.lzb.musicplayer.bean.MusicFile;

public class RingtoneAdapter extends ProviderMultiAdapter<MusicFile> {

    public RingtoneAdapter() {
        addItemProvider(new SelAudioProvider());
    }

    private class SelAudioProvider extends BaseItemProvider<MusicFile> {
        @Override
        public int getItemViewType() {
            return ProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_sel_audio;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, MusicFile bean) {
            baseViewHolder.setText(R.id.tvSelAudioItemName, bean.getTitle());
            baseViewHolder.setText(R.id.tvSelAudioItemSize, ConvertUtils.byte2FitMemorySize(FileUtils.getFileLength(bean.getPath()), 1));
        }
    }


}
